<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>JavaScript知识点总结(十四.JavaScript之PC端网页特效) | 小何blog (记录美好)</title><meta name="keywords" content="系列🏬,JavaScript,PC网页特效"><meta name="author" content="六根清静"><meta name="copyright" content="六根清静"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="JavaScript之PC端网页特效，里面有常用的PC电脑端常见的网页特效，有助于对PC端网页制作和学习，增强网页效果功能。">
<meta property="og:type" content="article">
<meta property="og:title" content="JavaScript知识点总结(十四.JavaScript之PC端网页特效)">
<meta property="og:url" content="https://liugenqingjing2.coding.me/2020/09/21/JavaScript%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7%BB%93-%E5%8D%81%E5%9B%9B-JavaScript%E4%B9%8BPC%E7%AB%AF%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88/index.html">
<meta property="og:site_name" content="小何blog (记录美好)">
<meta property="og:description" content="JavaScript之PC端网页特效，里面有常用的PC电脑端常见的网页特效，有助于对PC端网页制作和学习，增强网页效果功能。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/QU!@4UguoQC1.jpg">
<meta property="article:published_time" content="2020-09-21T12:41:39.000Z">
<meta property="article:modified_time" content="2021-01-10T12:15:22.047Z">
<meta property="article:author" content="六根清静">
<meta property="article:tag" content="系列🏬">
<meta property="article:tag" content="JavaScript">
<meta property="article:tag" content="PC网页特效">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/QU!@4UguoQC1.jpg"><link rel="shortcut icon" href="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200907/wOu*ZmuVb5A4.png"><link rel="canonical" href="https://liugenqingjing2.coding.me/2020/09/21/JavaScript%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7%BB%93-%E5%8D%81%E5%9B%9B-JavaScript%E4%B9%8BPC%E7%AB%AF%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin="crossorigin"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e829919a4d931d733ee74d5d97a51582";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":20,"languages":{"author":"作者: 六根清静","link":"链接: ","source":"来源: 小何blog (记录美好)","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  ClickShowText: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: true
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-01-10 20:15:22'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = '2'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
   if (asideStatus === 'hide') {
     document.documentElement.classList.add('hide-aside')
   } else {
     document.documentElement.classList.remove('hide-aside')
   }
}})()</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"><link rel="stylesheet" href="/css/shuo.css"/><link rel="stylesheet" href="/magnetcss/magnet.css"/><link rel="stylesheet" href="/css/calendar.css"/><link rel="stylesheet" href="//at.alicdn.com/t/font_2060620_l0j6b710zk.css"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/font-awesome-animation.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/macblack.css"><link rel="stylesheet" href="/css/change.css"><link rel="stylesheet" href="/news/css/news.css"/><style type="text/css">#toggle-sidebar {bottom: 80px}</style><link rel="stylesheet" href="/magnet/css/catalogMagnet.css"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-double-row-display@1.00/cardlistpost.css"/><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/iconfont.min.css"><link rel="stykesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/pool.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"/><link rel="stylesheet" href="/zan/zan.css"><link rel="stylesheet" href="/swiper/swiper.min.css"><link rel="stylesheet" href="/swiper/swiperstyle.css"><style>#article-container.post-content h1:before, h2:before, h3:before, h4:before, h5:before, h6:before { -webkit-animation: avatar_turn_around 1s linear infinite; -moz-animation: avatar_turn_around 1s linear infinite; -o-animation: avatar_turn_around 1s linear infinite; -ms-animation: avatar_turn_around 1s linear infinite; animation: avatar_turn_around 1s linear infinite; }</style><meta name="generator" content="Hexo 5.0.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="wizard-scene"><div class="wizard-objects"><div class="wizard-square"></div><div class="wizard-circle"></div><div class="wizard-triangle"></div></div><div class="wizard"><div class="wizard-body"></div><div class="wizard-right-arm"><div class="wizard-right-hand"></div></div><div class="wizard-left-arm"><div class="wizard-left-hand"></div></div><div class="wizard-head"><div class="wizard-beard"></div><div class="wizard-face"><div class="wizard-adds"></div></div><div class="wizard-hat"><div class="wizard-hat-of-the-hat"></div><div class="wizard-four-point-star --first"></div><div class="wizard-four-point-star --second"></div><div class="wizard-four-point-star --third"></div></div></div></div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" data-lazy-src="http://01.027cgb.com/632500/1576904533264.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">138</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">63</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">8</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/stars/"><i class="fa-fw fas fa-star faa-shake animated-hover"></i><span> 收藏网址</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw iconfont icon-zhuye faa-shake animated-hover"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog.html"><i class="fa-fw iconfont icon-Artboard faa-shake animated-hover"></i><span> 博客</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw iconfont icon-guidang faa-shake animated-hover"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw iconfont icon-biaoqian faa-shake animated-hover"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-yule1"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/movies/"><i class="fa-fw iconfont icon-yingshi faa-shake animated-hover"></i><span> 影视</span></a></li><li><a class="site-page" href="/games/"><i class="fa-fw iconfont icon-youxi1 faa-shake animated-hover"></i><span> 游戏</span></a></li><li><a class="site-page" href="/galleryGroup"><i class="fa-fw iconfont icon-tuku faa-shake animated-hover"></i><span> 图库</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/messagepad/"><i class="fa-fw iconfont icon-ziyuan6 faa-shake animated-hover"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw iconfont icon-icon_xinyong_xianxing_jijin- faa-shake animated-hover"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw iconfont icon-guanyuwomen faa-shake animated-hover"></i><span> 关于我</span></a></div></div></div></div><div id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/QU!@4UguoQC1.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">小何blog (记录美好)</a></span><span id="menus"><div id="search_button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/stars/"><i class="fa-fw fas fa-star faa-shake animated-hover"></i><span> 收藏网址</span></a></div><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw iconfont icon-zhuye faa-shake animated-hover"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog.html"><i class="fa-fw iconfont icon-Artboard faa-shake animated-hover"></i><span> 博客</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw iconfont icon-guidang faa-shake animated-hover"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw iconfont icon-biaoqian faa-shake animated-hover"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw iconfont icon-yule1"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/movies/"><i class="fa-fw iconfont icon-yingshi faa-shake animated-hover"></i><span> 影视</span></a></li><li><a class="site-page" href="/games/"><i class="fa-fw iconfont icon-youxi1 faa-shake animated-hover"></i><span> 游戏</span></a></li><li><a class="site-page" href="/galleryGroup"><i class="fa-fw iconfont icon-tuku faa-shake animated-hover"></i><span> 图库</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/messagepad/"><i class="fa-fw iconfont icon-ziyuan6 faa-shake animated-hover"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw iconfont icon-icon_xinyong_xianxing_jijin- faa-shake animated-hover"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw iconfont icon-guanyuwomen faa-shake animated-hover"></i><span> 关于我</span></a></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="post-info"><h1 class="post-title">JavaScript知识点总结(十四.JavaScript之PC端网页特效)</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-09-21T12:41:39.000Z" title="发表于 2020-09-21 20:41:39">2020-09-21</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-01-10T12:15:22.047Z" title="更新于 2021-01-10 20:15:22">2021-01-10</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%89%8D%E7%AB%AF%E5%AD%A6%E4%B9%A0/">前端学习</a></span></div><div class="meta-secondline"> <span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>6分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="PC-端网页特效："><a href="#PC-端网页特效：" class="headerlink" title="PC 端网页特效："></a>PC 端网页特效：</h1><blockquote>
<p>纯属随笔记录，具体详细教程，请查阅<a target="_blank" rel="noopener" href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript">MDN Web 文档</a></p>
</blockquote>
<ul>
<li><h2 id="元素偏移量-offset-系列："><a href="#元素偏移量-offset-系列：" class="headerlink" title="元素偏移量 offset 系列："></a>元素偏移量 offset 系列：</h2><ul>
<li><h3 id="offset-概述："><a href="#offset-概述：" class="headerlink" title="offset 概述："></a>offset 概述：</h3><blockquote>
<p><code>offset</code> 翻译过来就是<strong>偏移量</strong>， 我们使用 <code>offset</code> 系列相关属性可以<strong>动态的得到该元素的位置（偏移）、大小</strong>等。</p>
</blockquote>
<ul>
<li>获得元素距离<strong>带有定位父元素</strong>的位置</li>
<li>获得<strong>元素自身的大小（宽度高度）</strong></li>
<li>注意： 返回的数值都<strong>不带单位</strong></li>
</ul>
<h4 id="offset-系列常用属性："><a href="#offset-系列常用属性：" class="headerlink" title="offset 系列常用属性："></a>offset 系列常用属性：</h4><table>
<thead>
<tr>
<th align="center">offset系列属性</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">element.offsetParent</td>
<td align="center">返回作为该元素带有定位的父级元素如果父级都没有定位则返回body</td>
</tr>
<tr>
<td align="center">element.offsetTop</td>
<td align="center">返回元素相对带有定位父元素上方的偏移</td>
</tr>
<tr>
<td align="center">element.offsetLeft</td>
<td align="center">返回元素相对带有定位父元素左边框的偏移</td>
</tr>
<tr>
<td align="center">element.offsetWidth</td>
<td align="center">返回自身包括padding，边框、内容区的宽度，返回数值不带单位</td>
</tr>
<tr>
<td align="center">elermenl.offsetHeight</td>
<td align="center">返回白身包括padding、边框、内容区的高度，返回数值不带单位</td>
</tr>
</tbody></table>
<hr>
</li>
<li><h3 id="offset-与-style-区别："><a href="#offset-与-style-区别：" class="headerlink" title="offset 与 style 区别："></a>offset 与 style 区别：</h3><h4 id="offset："><a href="#offset：" class="headerlink" title="offset："></a>offset：</h4><ol>
<li><code>offset</code> 可以得到<strong>任意样式表中的样式值</strong></li>
<li><code>offset</code> 系列获得的数值是<strong>没有单位的</strong></li>
<li><code>offsetWidth</code> 包含<code>padding+border+width</code></li>
<li><code>offsetWidth</code> 等属性是<strong>只读属性</strong>，<strong>只能获取不能赋值</strong></li>
<li><strong>所以，我们想要获取元素大小位置，用offset更合适</strong></li>
</ol>
<hr>
<h4 id="style"><a href="#style" class="headerlink" title="style:"></a>style:</h4><ol>
<li><code>style</code> 只能得到<strong>行内样式表中的样式值</strong></li>
<li><code>style.width</code> 获得的是带<strong>有单位的字符串</strong></li>
<li><code>style.width</code> 获得<strong>不包含<code>padding</code>和<code>border</code> 的值</strong></li>
<li><code>style.width</code> 是<strong>可读写属性</strong>，可以获取也可以赋值</li>
<li><strong>所以，我们想要给元素更改值，则需要用style改变</strong></li>
</ol>
<p><img src= "/img/loading.gif" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/PFlV0IVp4UmX.png" alt="offset解析"></p>
<hr>
</li>
<li><h3 id="案例："><a href="#案例：" class="headerlink" title="案例："></a>案例：</h3><ul>
<li><strong>获取鼠标在盒子内的坐标</strong></li>
</ul>
<h4 id="代码"><a href="#代码" class="headerlink" title="代码:"></a>代码:</h4><figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="keyword">var</span> box = <span class="built_in">document</span>.querySelector(<span class="string">&#x27;.box&#x27;</span>);</span><br><span class="line">box.addEventListener(<span class="string">&#x27;mousemove&#x27;</span>, <span class="function"><span class="keyword">function</span>(<span class="params">e</span>) </span>&#123;</span><br><span class="line">    <span class="keyword">var</span> x = e.pageX - <span class="built_in">this</span>.offsetLeft;</span><br><span class="line">    <span class="keyword">var</span> y = e.pageY - <span class="built_in">this</span>.offsetTop;</span><br><span class="line">    <span class="built_in">this</span>.innerHTML = <span class="string">&#x27;x坐标是&#x27;</span> + x + <span class="string">&#x27; y坐标是&#x27;</span> + y;</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>

<h4 id="效果"><a href="#效果" class="headerlink" title="效果:"></a>效果:</h4><p><img src= "/img/loading.gif" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/4cKbFNKnAS8M.gif" alt="效果图"></p>
</li>
</ul>
<hr>
</li>
<li><h2 id="元素可视区-client-系列："><a href="#元素可视区-client-系列：" class="headerlink" title="元素可视区 client 系列："></a>元素可视区 client 系列：</h2><blockquote>
<p><strong>client</strong> 翻译过来就是<strong>客户端</strong>，我们使用 client 系列的相关属性来获取元素<strong>可视区</strong>的相关信息。<strong>通过 client 系列的相关属性可以动态的得到该元素的边框大小、元素大小等</strong>。</p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">client系列属性</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">element.clientTop</td>
<td align="center">返回元素上边框的大小</td>
</tr>
<tr>
<td align="center">element.clientLeft</td>
<td align="center">返回元素左边框的大小</td>
</tr>
<tr>
<td align="center">element.clientWidth</td>
<td align="center">返回自身包括padding，内容区的宽度，不含边框，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.clientHeight</td>
<td align="center">返回自身包括padding，内容区的高度，不含边框，返回数值不带单位</td>
</tr>
</tbody></table>
<p><img src= "/img/loading.gif" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/TmEfjCUaj!Uu.png" alt="client解析"></p>
<hr>
</li>
<li><h2 id="元素滚动-scroll-系列："><a href="#元素滚动-scroll-系列：" class="headerlink" title="元素滚动 scroll 系列："></a>元素滚动 scroll 系列：</h2><ul>
<li><h3 id="元素-scroll-系列属性："><a href="#元素-scroll-系列属性：" class="headerlink" title="元素 scroll 系列属性："></a>元素 scroll 系列属性：</h3><blockquote>
<p><code>scroll</code> 翻译过来就是滚动的，我们使用 scroll 系列的相关属性可以<strong>动态的得到该元素的大小、滚动距离等</strong>。</p>
</blockquote>
<table>
<thead>
<tr>
<th align="center">scroll系列属性</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">element.scrollTop</td>
<td align="center">返回被卷去的上侧距离，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.scrollLeft</td>
<td align="center">返回被卷去的左侧距离，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.scrollWidth</td>
<td align="center">返回自身实际的宽度，不含边框，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.scrollHeight</td>
<td align="center">返回自身实际的高度，不含边框，返回数值不带单位</td>
</tr>
</tbody></table>
<p><img src= "/img/loading.gif" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/kUekfRrCpgAl.png" alt="scroll解析"></p>
<hr>
</li>
<li><h3 id="页面被卷去的头部："><a href="#页面被卷去的头部：" class="headerlink" title="页面被卷去的头部："></a>页面被卷去的头部：</h3><ul>
<li>如果浏览器的高（或宽）度不足以显示整个页面时，会自动出现滚动条。<strong>当滚动条向下滚动时，页面上面被隐藏掉的高度，我们就称为页面被卷去的头部</strong>。滚动条在滚动时会触发 <code>onscroll</code> 事件。</li>
</ul>
<hr>
</li>
<li><h3 id="页面被卷去的头部兼容性解决方案"><a href="#页面被卷去的头部兼容性解决方案" class="headerlink" title="页面被卷去的头部兼容性解决方案:"></a>页面被卷去的头部兼容性解决方案:</h3><ul>
<li><p>需要注意的是，页面被卷去的头部，<strong>有兼容性问题</strong>，因此被卷去的头部通常有如下几种写法：</p>
<ol>
<li>声明了 DTD，使用 <code>document.documentElement.scrollTop</code></li>
<li>未声明 DTD，使用  <code>document.body.scrollTop</code></li>
<li>新方法 <code>window.pageYOffset</code> 和 <code>window.pageXOffset</code>，<strong>IE9 开始支持</strong></li>
</ol>
</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">getScroll</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">      left: <span class="built_in">window</span>.pageXOffset || <span class="built_in">document</span>.documentElement.scrollLeft ||         <span class="built_in">document</span>.body.scrollLeft||<span class="number">0</span>,</span><br><span class="line">      top: <span class="built_in">window</span>.pageYOffset || <span class="built_in">document</span>.documentElement.scrollTop || <span class="built_in">document</span>.body.scrollTop || <span class="number">0</span></span><br><span class="line">    &#125;;</span><br><span class="line"> &#125; </span><br><span class="line">使用的时候:  getScroll().left</span><br></pre></td></tr></table></figure>

</li>
</ul>
<hr>
</li>
<li><h2 id="三大系列总结"><a href="#三大系列总结" class="headerlink" title="三大系列总结:"></a>三大系列总结:</h2><table>
<thead>
<tr>
<th align="center">三大系列大小对比</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody><tr>
<td align="center">element.offsetWidth</td>
<td align="center">返回自身包括padding，边框、内容区的宽度，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.clientWidth</td>
<td align="center">返回自身包括padding、内容区的宽度，不含边框，返回数值不带单位</td>
</tr>
<tr>
<td align="center">element.scrollWidth</td>
<td align="center">返回自身实际的宽度，不含边框，返回数值不带单位</td>
</tr>
</tbody></table>
<ul>
<li><strong>他们主要用法：</strong><ul>
<li><code>offset</code>系列 经常用于获得<strong>元素位置</strong>    <code>offsetLeft  offsetTop</code></li>
<li><code>client</code> 经常用于获取<strong>元素大小</strong>  <code>clientWidth  clientHeight</code></li>
<li><code>scroll</code> 经常用于获取<strong>滚动距离</strong>  <code>scrollTop  scrollLeft   </code></li>
<li>注意<strong>页面滚动的距离</strong>通过 <code>window.pageXOffset</code>  获得</li>
</ul>
</li>
</ul>
<hr>
</li>
<li><h2 id="mouseenter-和mouseover的区别"><a href="#mouseenter-和mouseover的区别" class="headerlink" title="mouseenter 和mouseover的区别:"></a>mouseenter 和mouseover的区别:</h2><ul>
<li><h3 id="mouseenter-鼠标事件"><a href="#mouseenter-鼠标事件" class="headerlink" title="mouseenter 鼠标事件:"></a>mouseenter 鼠标事件:</h3><ul>
<li>当鼠标移动到元素上时就会触发 <code>mouseenter</code> 事件</li>
</ul>
</li>
</ul>
</li>
<li><p>类似 <code>mouseover</code>，它们两者之间的差别是：</p>
<ul>
<li><code>mouseover</code> 鼠标<strong>经过自身盒子会触发，经过子盒子还会触发</strong>。 <code>mouseenter</code>  只会经过<strong>自身盒子触发</strong></li>
</ul>
</li>
<li><p>之所以这样，就是因为<code>mouseenter</code><strong>不会冒泡</strong></p>
<ul>
<li>跟<code>mouseenter</code>搭配 鼠标离开 <code>mouseleave</code>  同样不会冒泡</li>
</ul>
<hr>
</li>
<li><h2 id="动画函数封装"><a href="#动画函数封装" class="headerlink" title="动画函数封装:"></a>动画函数封装:</h2><ul>
<li><h3 id="动画实现原理"><a href="#动画实现原理" class="headerlink" title="动画实现原理:"></a>动画实现原理:</h3></li>
</ul>
<blockquote>
<h4 id="核心原理：通过定时器-setInterval-不断移动盒子位置。"><a href="#核心原理：通过定时器-setInterval-不断移动盒子位置。" class="headerlink" title="核心原理：通过定时器 setInterval()不断移动盒子位置。"></a>核心原理：通过定时器 <code>setInterval()</code>不断移动盒子位置。</h4></blockquote>
<h4 id="实现步骤："><a href="#实现步骤：" class="headerlink" title="实现步骤："></a>实现步骤：</h4><ol>
<li>获得盒子当前位置</li>
<li>让盒子在当前位置加上1个移动距离</li>
<li>利用定时器不断重复这个操作</li>
<li>加一个结束定时器的条件</li>
<li>注意此元素需要添加定位，才能使用<code>element.style.left</code></li>
</ol>
<hr>
<ul>
<li><h3 id="动画函数封装-1"><a href="#动画函数封装-1" class="headerlink" title="动画函数封装:"></a>动画函数封装:</h3><ul>
<li>注意函数需要传递<strong>2个参数</strong>，<strong>动画对象</strong>和<strong>移动到的距离</strong>。</li>
</ul>
<hr>
</li>
<li><h3 id="动画函数给不同元素记录不同定时器"><a href="#动画函数给不同元素记录不同定时器" class="headerlink" title="动画函数给不同元素记录不同定时器 :"></a>动画函数给不同元素记录不同定时器 :</h3><ul>
<li>如果多个元素都使用这个动画函数，每次都要<code>var</code> 声明定时器。我们可以给不同的元素使用<strong>不同的定时器（自己专门用自己的定时器）</strong>。</li>
</ul>
<h4 id="核心原理："><a href="#核心原理：" class="headerlink" title="核心原理："></a>核心原理：</h4><p>利用 JS 是一门<strong>动态语言</strong>，可以很方便的给当前对象添加属性。</p>
<hr>
</li>
<li><h3 id="缓动效果原理"><a href="#缓动效果原理" class="headerlink" title="缓动效果原理:"></a>缓动效果原理:</h3><ul>
<li><strong>缓动动画</strong>就是让元素<strong>运动速度有所变化</strong>，最常见的是让速度慢慢停下来</li>
</ul>
<h4 id="思路："><a href="#思路：" class="headerlink" title="思路："></a>思路：</h4><ol>
<li>让盒子每次移动的距离慢慢变小，速度就会慢慢落下来。</li>
<li><strong>核心算法：</strong> (目标值 - 现在的位置 )   /   10    做为每次移动的距离 步长</li>
<li>停止的条件是： 让当前盒子位置等于目标位置就停止定时器  </li>
<li>注意步长值需要取整   </li>
</ol>
<hr>
</li>
<li><h3 id="动画函数多个目标值之间移动"><a href="#动画函数多个目标值之间移动" class="headerlink" title="动画函数多个目标值之间移动:"></a>动画函数多个目标值之间移动:</h3><ul>
<li>可以让动画函数从 800 移动到 500。</li>
<li>当我们点击按钮时候，判断<strong>步长是正值还是负值</strong>:<ol>
<li>如果是<strong>正值</strong>，则步长 往大了取整</li>
<li>如果是<strong>负值</strong>，则步长 向小了取整</li>
</ol>
</li>
</ul>
<hr>
</li>
<li><h3 id="动画函数添加回调函数"><a href="#动画函数添加回调函数" class="headerlink" title="动画函数添加回调函数:"></a>动画函数添加回调函数:</h3><blockquote>
<p><strong>回调函数原理：</strong> <strong>函数可以作为一个参数</strong>。将这个函数作为参数传到另一个函数里面，当那个函数执行完之后，再执行传进去的这个函数，这个过程就叫做<strong>回调</strong>。</p>
</blockquote>
<ul>
<li>回调函数写的位置：<strong>定时器结束的位置</strong>。</li>
</ul>
<hr>
</li>
<li><h3 id="动画函数封装到单独JS文件里面："><a href="#动画函数封装到单独JS文件里面：" class="headerlink" title="动画函数封装到单独JS文件里面："></a>动画函数封装到单独JS文件里面：</h3><ul>
<li>因为以后经常使用这个动画函数，可以<strong>单独封装到一个JS文件</strong>里面，使用的时候引用这个JS文件即可。<ol>
<li>单独新建一个JS文件。</li>
<li>HTML文件引入 JS 文件。</li>
</ol>
</li>
</ul>
</li>
</ul>
<hr>
</li>
<li><h2 id="常见网页特效案例："><a href="#常见网页特效案例：" class="headerlink" title="常见网页特效案例："></a>常见网页特效案例：</h2><ul>
<li><h3 id="节流阀："><a href="#节流阀：" class="headerlink" title="节流阀："></a>节流阀：</h3><ul>
<li><p><strong>防止轮播图按钮连续点击造成播放过快。</strong></p>
</li>
<li><p><strong>节流阀目的</strong>：当上一个函数动画内容执行完毕，再去执行下一个函数动画，让事件<strong>无法连续触发</strong>。</p>
</li>
<li><p><strong>核心实现思路：</strong>利用回调函数，<strong>添加一个变量</strong>来控制，<strong>锁住函数和解锁函数</strong>。</p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">开始设置一个变量 <span class="keyword">var</span> flag = <span class="literal">true</span>;</span><br><span class="line">If(flag) &#123;flag = <span class="literal">false</span>; <span class="keyword">do</span> something&#125;       关闭水龙头</span><br><span class="line">利用回调函数 动画执行完毕， flag = <span class="literal">true</span>     打开水龙头</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><h3 id="轮播图："><a href="#轮播图：" class="headerlink" title="轮播图："></a>轮播图：</h3><ul>
<li>可以看代码案例里面看</li>
</ul>
</li>
</ul>
<hr>
</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">六根清静</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://liugenqingjing2.coding.me/2020/09/21/JavaScript%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7%BB%93-%E5%8D%81%E5%9B%9B-JavaScript%E4%B9%8BPC%E7%AB%AF%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88/">https://liugenqingjing2.coding.me/2020/09/21/JavaScript知识点总结-十四-JavaScript之PC端网页特效/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://liugenqingjing2.coding.me" target="_blank">小何blog (记录美好)</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E7%B3%BB%E5%88%97%F0%9F%8F%AC/">系列🏬</a><a class="post-meta__tags" href="/tags/JavaScript/">JavaScript</a><a class="post-meta__tags" href="/tags/PC%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88/">PC网页特效</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/QU!@4UguoQC1.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏<div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="http://qew58kkb2.hn-bkt.clouddn.com/wechat%20%20%281%29.png" target="_blank"><img class="post-qr-code-img" data-lazy-src="http://qew58kkb2.hn-bkt.clouddn.com/wechat%20%20%281%29.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li></ul></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2020/09/21/%E6%A8%A1%E6%80%81%E6%A1%86%E6%8B%96%E6%8B%BD/"><img class="prev-cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/hj^gLyc2!Ib@.jpg" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">模态框拖拽</div></div></a></div><div class="next-post pull-right"><a href="/2020/09/21/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84-%E4%B8%80-%E5%9F%BA%E6%9C%AC%E6%A6%82%E5%BF%B5/"><img class="next-cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200921/t0Be9oQ!mlLa.jpg" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">数据结构(一.基本概念)</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/2020/09/17/JavaScript知识点总结-九-JavaScript的Web-APIs简介/" title="JavaScript知识点总结(九.JavaScript的Web APIs简介)"><img class="cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200917/7cKUzRmy@FxZ.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-17</div><div class="title">JavaScript知识点总结(九.JavaScript的Web APIs简介)</div></div></a></div><div><a href="/2020/09/13/JavaScript知识点总结-七-JavaScript预解析和对象/" title="JavaScript知识点总结(七.JavaScript预解析和对象)"><img class="cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20200913/WKp@vPE1Cm1Z.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-13</div><div class="title">JavaScript知识点总结(七.JavaScript预解析和对象)</div></div></a></div><div><a href="/2020/10/10/JavaScript知识点总结-二十-JavaScript之正则表达式/" title="JavaScript知识点总结(二十.JavaScript之正则表达式)"><img class="cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20201010/QbU2o0zob3F@.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-10</div><div class="title">JavaScript知识点总结(二十.JavaScript之正则表达式)</div></div></a></div><div><a href="/2020/09/05/JavaScript知识点总结-二-JavaScript简介/" title="JavaScript知识点总结(二.JavaScript简介)"><img class="cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/文章bg/v2-fdfecf9ae52fea38652fdc86757173a6_r.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-05</div><div class="title">JavaScript知识点总结(二.JavaScript简介)</div></div></a></div><div><a href="/2020/10/11/JavaScript知识点总结-二十一-JavaScript之ES6语法/" title="JavaScript知识点总结(二十一.JavaScript之ES6语法)"><img class="cover" data-lazy-src="http://q.027cgb.com/632500/v2-a19ffd54924b0522435c7d4e67a7aab5_r.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-11</div><div class="title">JavaScript知识点总结(二十一.JavaScript之ES6语法)</div></div></a></div><div><a href="/2020/09/09/JavaScript知识点总结-五-ECMAScript之数组/" title="JavaScript知识点总结(五.ECMAScript之数组)"><img class="cover" data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/文章bg/v2-fb37f4ec3f0e1eff232ec6e3b225f86a_r.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-09</div><div class="title">JavaScript知识点总结(五.ECMAScript之数组)</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" data-lazy-src="http://01.027cgb.com/632500/1576904533264.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">六根清静</div><div class="author-info__description">记录美好，记录生活，记录学习</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">138</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">63</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">8</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/he_chaoming/dashboard/projects?scope=public&amp;&amp;sort="><i class="fab fa-gofore"></i><span>My Gitee</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/he1213114428" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:484695754@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="tencent://message/?uin=484695754" target="_blank" title="QQ"><i class="fab fa-qq"></i></a></div></div></div><div class="card-widget card-recent-post"><div id="gamenews"><div class="card-content"><div class="item-headline"><i class="fas fa-cube"></i><span>ROLL资讯</span><i class="fas fa-retweet" @click="changetype(current)" style="float:right;margin-top:8px"></i></div><div class="newsbar"><span v-for="(type, index) in listtype" v-on:click="addClass(index)" v-bind:class="{ listtypeon:index==current}">{{type}}</span></div><div class="aside-list"><div class="aside-list-item" v-for="(news,index) in newsvue"><a class="thumbnail" href="javascript:void(0)" @click="getnewsdata(index)" :title="news.title"><img class="loaded" onerror="this.onerror=null;this.src='/img/404.jpg'" data-ll-status="loaded" :src="news.imgList[0]"/></a><div class="content"><a class="title" href="javascript:void(0)" @click="getnewsdata(index)" :title="news.title">{{news.title}}</a><time>{{news.postTime}}</time></div></div></div></div><div id="newsmodal"><button class="modalclose" @click="hidemodle()">关闭</button><h2>{{newpostvue.title}} </h2><h4>{{newpostvue.ptime}} &nbsp;&nbsp; {{newpostvue.source}}</h4><div v-html="newpostvue.content"></div></div></div></div><div class="card-widget card-shuo"><div class="card-content" style="height:auto;min-height:280px;"><div class="item-headline"><i class="fas fa-comments"></i><span>&#x8BF4;&#x8BF4</span><a id="shuovisualchange" style="cursor:pointer;float:right" onclick="shuovisualchange()">编辑</a></div><div id="artitalk_main" style="width:100%;height:100%;padding:10px"></div></div></div><div class="sticky_layout"></div><div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-paw fa-spin"></i><span>那年今日</span></div><div id="history-news" style="height: 100px;overflow: hidden;"><div id="history-card"></div></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">大学生一枚，软件工程，想做全栈攻城狮，哈哈，有兴趣可以加 QQ:484695754 (也可以点上面的logo)，一起交流学习</div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="card-content"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#PC-%E7%AB%AF%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88%EF%BC%9A"><span class="toc-number">1.</span> <span class="toc-text">PC 端网页特效：</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%83%E7%B4%A0%E5%81%8F%E7%A7%BB%E9%87%8F-offset-%E7%B3%BB%E5%88%97%EF%BC%9A"><span class="toc-number">1.1.</span> <span class="toc-text">元素偏移量 offset 系列：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#offset-%E6%A6%82%E8%BF%B0%EF%BC%9A"><span class="toc-number">1.1.1.</span> <span class="toc-text">offset 概述：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#offset-%E7%B3%BB%E5%88%97%E5%B8%B8%E7%94%A8%E5%B1%9E%E6%80%A7%EF%BC%9A"><span class="toc-number">1.1.1.1.</span> <span class="toc-text">offset 系列常用属性：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#offset-%E4%B8%8E-style-%E5%8C%BA%E5%88%AB%EF%BC%9A"><span class="toc-number">1.1.2.</span> <span class="toc-text">offset 与 style 区别：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#offset%EF%BC%9A"><span class="toc-number">1.1.2.1.</span> <span class="toc-text">offset：</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#style"><span class="toc-number">1.1.2.2.</span> <span class="toc-text">style:</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A1%88%E4%BE%8B%EF%BC%9A"><span class="toc-number">1.1.3.</span> <span class="toc-text">案例：</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BB%A3%E7%A0%81"><span class="toc-number">1.1.3.1.</span> <span class="toc-text">代码:</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%95%88%E6%9E%9C"><span class="toc-number">1.1.3.2.</span> <span class="toc-text">效果:</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%83%E7%B4%A0%E5%8F%AF%E8%A7%86%E5%8C%BA-client-%E7%B3%BB%E5%88%97%EF%BC%9A"><span class="toc-number">1.2.</span> <span class="toc-text">元素可视区 client 系列：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%83%E7%B4%A0%E6%BB%9A%E5%8A%A8-scroll-%E7%B3%BB%E5%88%97%EF%BC%9A"><span class="toc-number">1.3.</span> <span class="toc-text">元素滚动 scroll 系列：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%83%E7%B4%A0-scroll-%E7%B3%BB%E5%88%97%E5%B1%9E%E6%80%A7%EF%BC%9A"><span class="toc-number">1.3.1.</span> <span class="toc-text">元素 scroll 系列属性：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%A1%B5%E9%9D%A2%E8%A2%AB%E5%8D%B7%E5%8E%BB%E7%9A%84%E5%A4%B4%E9%83%A8%EF%BC%9A"><span class="toc-number">1.3.2.</span> <span class="toc-text">页面被卷去的头部：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%A1%B5%E9%9D%A2%E8%A2%AB%E5%8D%B7%E5%8E%BB%E7%9A%84%E5%A4%B4%E9%83%A8%E5%85%BC%E5%AE%B9%E6%80%A7%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88"><span class="toc-number">1.3.3.</span> <span class="toc-text">页面被卷去的头部兼容性解决方案:</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%89%E5%A4%A7%E7%B3%BB%E5%88%97%E6%80%BB%E7%BB%93"><span class="toc-number">1.4.</span> <span class="toc-text">三大系列总结:</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#mouseenter-%E5%92%8Cmouseover%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-number">1.5.</span> <span class="toc-text">mouseenter 和mouseover的区别:</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#mouseenter-%E9%BC%A0%E6%A0%87%E4%BA%8B%E4%BB%B6"><span class="toc-number">1.5.1.</span> <span class="toc-text">mouseenter 鼠标事件:</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E5%B0%81%E8%A3%85"><span class="toc-number">1.6.</span> <span class="toc-text">动画函数封装:</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86"><span class="toc-number">1.6.1.</span> <span class="toc-text">动画实现原理:</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B8%E5%BF%83%E5%8E%9F%E7%90%86%EF%BC%9A%E9%80%9A%E8%BF%87%E5%AE%9A%E6%97%B6%E5%99%A8-setInterval-%E4%B8%8D%E6%96%AD%E7%A7%BB%E5%8A%A8%E7%9B%92%E5%AD%90%E4%BD%8D%E7%BD%AE%E3%80%82"><span class="toc-number">1.6.1.1.</span> <span class="toc-text">核心原理：通过定时器 setInterval()不断移动盒子位置。</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E5%AE%9E%E7%8E%B0%E6%AD%A5%E9%AA%A4%EF%BC%9A"><span class="toc-number">1.6.1.2.</span> <span class="toc-text">实现步骤：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E5%B0%81%E8%A3%85-1"><span class="toc-number">1.6.2.</span> <span class="toc-text">动画函数封装:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E7%BB%99%E4%B8%8D%E5%90%8C%E5%85%83%E7%B4%A0%E8%AE%B0%E5%BD%95%E4%B8%8D%E5%90%8C%E5%AE%9A%E6%97%B6%E5%99%A8"><span class="toc-number">1.6.3.</span> <span class="toc-text">动画函数给不同元素记录不同定时器 :</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%A0%B8%E5%BF%83%E5%8E%9F%E7%90%86%EF%BC%9A"><span class="toc-number">1.6.3.1.</span> <span class="toc-text">核心原理：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%BC%93%E5%8A%A8%E6%95%88%E6%9E%9C%E5%8E%9F%E7%90%86"><span class="toc-number">1.6.4.</span> <span class="toc-text">缓动效果原理:</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%80%9D%E8%B7%AF%EF%BC%9A"><span class="toc-number">1.6.4.1.</span> <span class="toc-text">思路：</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E5%A4%9A%E4%B8%AA%E7%9B%AE%E6%A0%87%E5%80%BC%E4%B9%8B%E9%97%B4%E7%A7%BB%E5%8A%A8"><span class="toc-number">1.6.5.</span> <span class="toc-text">动画函数多个目标值之间移动:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E6%B7%BB%E5%8A%A0%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0"><span class="toc-number">1.6.6.</span> <span class="toc-text">动画函数添加回调函数:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E7%94%BB%E5%87%BD%E6%95%B0%E5%B0%81%E8%A3%85%E5%88%B0%E5%8D%95%E7%8B%ACJS%E6%96%87%E4%BB%B6%E9%87%8C%E9%9D%A2%EF%BC%9A"><span class="toc-number">1.6.7.</span> <span class="toc-text">动画函数封装到单独JS文件里面：</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B8%B8%E8%A7%81%E7%BD%91%E9%A1%B5%E7%89%B9%E6%95%88%E6%A1%88%E4%BE%8B%EF%BC%9A"><span class="toc-number">1.7.</span> <span class="toc-text">常见网页特效案例：</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%8A%82%E6%B5%81%E9%98%80%EF%BC%9A"><span class="toc-number">1.7.1.</span> <span class="toc-text">节流阀：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BD%AE%E6%92%AD%E5%9B%BE%EF%BC%9A"><span class="toc-number">1.7.2.</span> <span class="toc-text">轮播图：</span></a></li></ol></li></ol></li></ol></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/03/21/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%B8%89-%E8%B7%A8%E5%9F%9F%E4%BB%8B%E7%BB%8D%E5%92%8CJSONP%E4%BB%8B%E7%BB%8D/" title="Node.js学习(二十三.跨域介绍和JSONP介绍)"><img data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20210321/qWPEashJOuNK.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Node.js学习(二十三.跨域介绍和JSONP介绍)"/></a><div class="content"><a class="title" href="/2021/03/21/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%B8%89-%E8%B7%A8%E5%9F%9F%E4%BB%8B%E7%BB%8D%E5%92%8CJSONP%E4%BB%8B%E7%BB%8D/" title="Node.js学习(二十三.跨域介绍和JSONP介绍)">Node.js学习(二十三.跨域介绍和JSONP介绍)</a><time datetime="2021-03-21T13:40:58.000Z" title="发表于 2021-03-21 21:40:58">2021-03-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/20/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%BA%8C-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B-%E4%B8%8B/" title="Node.js学习(二十二.Node.js项目流程(下))"><img data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20210320/CvAoe6kC5*f2.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Node.js学习(二十二.Node.js项目流程(下))"/></a><div class="content"><a class="title" href="/2021/03/20/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%BA%8C-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B-%E4%B8%8B/" title="Node.js学习(二十二.Node.js项目流程(下))">Node.js学习(二十二.Node.js项目流程(下))</a><time datetime="2021-03-20T14:33:29.000Z" title="发表于 2021-03-20 22:33:29">2021-03-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/15/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%B8%80-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B-%E4%B8%AD/" title="Node.js学习(二十一.Node.js项目流程(中))"><img data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20210320/gSrAfCznw@^F.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Node.js学习(二十一.Node.js项目流程(中))"/></a><div class="content"><a class="title" href="/2021/03/15/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81%E4%B8%80-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B-%E4%B8%AD/" title="Node.js学习(二十一.Node.js项目流程(中))">Node.js学习(二十一.Node.js项目流程(中))</a><time datetime="2021-03-15T04:35:12.000Z" title="发表于 2021-03-15 12:35:12">2021-03-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/14/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B(%E4%B8%8A)/" title="Node.js学习(二十.Node.js项目流程(上))"><img data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20210320/UMp@B^akHmf8.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Node.js学习(二十.Node.js项目流程(上))"/></a><div class="content"><a class="title" href="/2021/03/14/Node-js%E5%AD%A6%E4%B9%A0-%E4%BA%8C%E5%8D%81-Node-js%E9%A1%B9%E7%9B%AE%E6%B5%81%E7%A8%8B(%E4%B8%8A)/" title="Node.js学习(二十.Node.js项目流程(上))">Node.js学习(二十.Node.js项目流程(上))</a><time datetime="2021-03-14T14:36:58.000Z" title="发表于 2021-03-14 22:36:58">2021-03-14</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/02/27/Node-js%E5%AD%A6%E4%B9%A0-%E5%8D%81%E4%B9%9D-%E5%B0%81%E8%A3%85%E6%93%8D%E4%BD%9C%E6%95%B0%E6%8D%AE%E5%BA%93%E5%92%8CCSRF/" title="Node.js学习(十九.封装操作数据库和CSRF)"><img data-lazy-src="https://gitee.com/he_chaoming/blog_tuchuang/raw/master/20210227/EcgLTE4WPOp^.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Node.js学习(十九.封装操作数据库和CSRF)"/></a><div class="content"><a class="title" href="/2021/02/27/Node-js%E5%AD%A6%E4%B9%A0-%E5%8D%81%E4%B9%9D-%E5%B0%81%E8%A3%85%E6%93%8D%E4%BD%9C%E6%95%B0%E6%8D%AE%E5%BA%93%E5%92%8CCSRF/" title="Node.js学习(十九.封装操作数据库和CSRF)">Node.js学习(十九.封装操作数据库和CSRF)</a><time datetime="2021-02-27T13:20:18.000Z" title="发表于 2021-02-27 21:20:18">2021-02-27</time></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 六根清静</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi,  welcome  to  my  <a  href="">blog</a>!</div><div class="icp"><a><img class="icp-icon" src="/img/icp.png" alt="ICP"/><span>豫ICP备2020025430号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>由</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a>
 <span>提供支持</span></div></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script async="async">var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',()=> {preloader.endLoading()})
setTimeout(function(){preloader.endLoading();}, 50000);</script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    let initData = {
      el: '#vcomment',
      appId: 'kW2ft895T235y7DxmyJmXX5X-MdYXbMMI',
      appKey: 'v0zBPCAdwiJ0xg4s4eSfusLD',
      placeholder: '建议使用QQ邮箱，评论头像采用QQ头像',
      avatar: 'monsterid',
      meta: 'nick,mail,link'.split(','),
      pageSize: '10',
      lang: 'zh-CN',
      recordIP: false,
      serverURLs: 'https://???????.api.lncldglobal.com',
      emojiCDN: '',
      emojiMaps: "",
      enableQQ: true,
      path: window.location.pathname,
      master: '1f76478c4ec918ffc6d50de6b68db531'.split(','),
      friends: '5c?????bfe6rfc72a????e268ad3819c,7c?????bfe65fc02a????e2????3919c'.split(','),
      tagMeta: '博主,小伙伴,访客'.split(',')
    }

    if (true) { 
      initData.requiredFields= ('nick,mail'.split(','))
    }
    
    if (false) {
      const otherData = false
      initData = Object.assign({}, initData, otherData)
    }
    
    const valine = new Valine(initData)
  }

  if (typeof Valine === 'function') initValine() 
  else $.getScript('https://cdn.jsdelivr.net/gh/HCLonely/Valine@latest/dist/Valine.min.js', initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.querySelector('#vcomment'),loadValine)
  else setTimeout(() => loadValine(), 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src='https://cdn.jsdelivr.net/npm/artitalk'></script><script> $(".category-list-count").prepend("<i class=\"fas fa-book\"></i>");</script><script src="/js/list.js"></script><script src="/js/gitcalendar.js"></script><script src="/js/calendar.js"></script><script src="/js/xkTool.js"></script><script src="/js/pjax.js"></script><script src="/magnet/js/vue.min.js"></script><script src="/magnet/js/catalogMagnet.js"></script><script src="/js/airvisualapi.js"></script><script src="/js/history.js"></script><script src="/js/historyroll.js"></script><script src="/js/change.js"></script><script type="text/javascript" src="https://www.airvisual.com/scripts/widget_v2.0.js"></script><script> setTimeout(function(){$('.monoline').eq(0).html($(".monoline strong").eq(0).text().replace('°','℃'));},5000);</script><script src="https://cdn.jsdelivr.net/gh/sviptzk/HexoStaticFile@latest/Hexo/js/mouse_snow.min.js"></script><script src="/js/myBg.js"></script><script src="/js/shuo.js"></script><script src="/js/artitalkkey.js"></script><script src="/news/js/keys.js"></script><script src="/news/js/news.js"></script><script src="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/js/pool.min.js"><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/stars/stars.js"></script><script src="https://cdn1.lncld.net/static/js/3.5.0/av-min.js"></script><script src="/zan/zan.js"></script><div class="aplayer no-destroy" data-id="2916766519" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay="false" muted></div><script src="/swiper/swiper.min.js"></script><script src="/swiper/swiperindex.js"></script><script async src="//at.alicdn.com/t/font_2264842_3izu8i5eoc2.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="/js/third-party/fireworks.js"></script><script src="/js/third-party/activate-power-mode.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script>(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/6fdec148.js","daovoice")
</script><script>var isChatBtn = true
daovoice('init', {
  app_id: '6fdec148',},{
  launcher: { 
     disableLauncherIcon: isChatBtn // 悬浮 ICON 是否显示
  },
});
daovoice('update');

if (isChatBtn) {
  var chatBtnFn = () => {
    var chatBtn = document.getElementById("chat_btn")
    chatBtn.addEventListener("click", function(){
      daovoice('show')
    });
  }
  chatBtnFn()
} else {
  if (true) {
    function chatBtnHide () {
      daovoice('update', {},{
        launcher: { 
        disableLauncherIcon: true // 悬浮 ICON 是否显示
        },
      });
    }
    function chatBtnShow () {
      daovoice('update', {},{
        launcher: { 
        disableLauncherIcon: false // 悬浮 ICON 是否显示
        },
      });
    }
  }
}</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"scale":1,"hHeadPos":0.5,"vHeadPos":0.618,"jsonPath":"/live2dw/assets/unitychan.model.json"},"display":{"superSample":2,"width":150,"height":300,"position":"right","hOffset":0,"vOffset":-20},"mobile":{"show":true,"scale":0.6},"react":{"opacityDefault":0.7,"opacityOnHover":0.8},"log":false});</script></body></html>